home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / bsrc_250.zip / RECVSYNC.C < prev    next >
C/C++ Source or Header  |  1991-09-15  |  23KB  |  549 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*               This module was written by Vince Perriello                 */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*          FidoNet(R) Mail Session Called System Synchronization           */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  29. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /* You can contact Bit Bucket Software Co. at any one of the following      */
  34. /* addresses:                                                               */
  35. /*                                                                          */
  36. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n343.z1.fidonet.org         */
  40. /*                                                                          */
  41. /* Please feel free to contact us at any time to share your comments about  */
  42. /* our software and/or licensing policies.                                  */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*--------------------------------------------------------------------------*/
  46.  
  47.  
  48.  /*
  49.     Receiver Synchronization state table.
  50.    
  51.     This logic is used by the called system. It will determine the
  52.     type of mail transfer which can be used in communicating with
  53.     the calling system.
  54.    
  55.     This stuff was originally copied from a file sent to us by TJ.
  56.     (Of course, then we hacked the heck out of it!!!)
  57.   
  58.     Thanks, Tom.
  59.   
  60.  
  61.  .-----+----------+-------------------------+-------------------------+-----.
  62.  | RS0 | SyncInit |                         | Start 5 second idle tmr | RS1 |
  63.  |-----+----------+-------------------------+-------------------------+-----|
  64.  | RS1 | IdleWait | 1. 5 sec tmr expired    | Take the initiative     | RS2 |
  65.  |     |          +-------------------------+-------------------------+-----|
  66.  |     |          | 2. Carrier lost         | Session aborted         | exit|
  67.  |     |          +-------------------------+-------------------------+-----|
  68.  |     |          | 3. Peek = YOOHOO        | Looks like a live WaZOO | RS3 |
  69.  |     |          +-------------------------+-------------------------+-----|
  70.  |     |          | 4. Peek = TSYNC         | Live FSC001, we think   | RS3 |
  71.  |     |          +-------------------------+-------------------------+-----|
  72.  |     |          | 5. Peek = CR, LF, space | He looks alive          | RS2 |
  73.  |     |          +-------------------------+-------------------------+-----|
  74.  |     |          | 6. Other character      | Eat it                  | RS1 |
  75.  |-----+----------+-------------------------+-------------------------+-----|
  76.  | RS2 |SendBanner| 1. Error returned       | Session aborted         | exit|
  77.  |     |          +-------------------------+-------------------------+-----|
  78.  |     |          | 2. Banner sent OK       |                         | RS3 |
  79.  |-----+----------+-------------------------+-------------------------+-----|
  80.  | RS3 |RecvInit  |                         | Init ext-mail scan ptrs | RS4 |
  81.  |     |          |                         | Start 20 sec timer      |     |
  82.  |     |          |                         | Init 10 sec timer       |     |
  83.  |-----+----------+-------------------------+-------------------------+-----|
  84.  | RS4 |SendSync  | 1. Error returned       | Session aborted         | exit|
  85.  |     |(xmit sync+-------------------------+-------------------------+-----|
  86.  |     |string)   | 2. String sent OK       | Watch for sender sync   | RS5 |
  87.  |-----+----------+-------------------------+-------------------------+-----|
  88.  | RS5 | WaitSync | 1. Carrier lost         | Session aborted         | exit|
  89.  |     |          +-------------------------+-------------------------+-----|
  90.  |     |          | 2. YOOHOO received      | WaZOO session selected  | exit|
  91.  |     |          +-------------------------+-------------------------+-----|
  92.  |     |          | 3. TSYNC received       | probable FSC001         | RS6 |
  93.  |     |          +-------------------------+-------------------------+-----|
  94.  |     |          | 4. CR received          | Still sync'ing          | RS4 |
  95.  |     |          +-------------------------+-------------------------+-----|
  96.  |     |          | 5. ESC received         | BBS session             | exit|
  97.  |     |          +-------------------------+-------------------------+-----|
  98.  |     |          | 6. Other character rcvd | check ext-mail string   | RS7 |
  99.  |     |          +-------------------------+-------------------------+-----|
  100.  |     |          | 7. 10 sec timer elapsed | FSC001 protocol selected| exit|
  101.  |     |          +-------------------------+-------------------------+-----|
  102.  |     |          | 8. 20 sec timer elapsed | Not a mail session      | exit|
  103.  |-----+----------+-------------------------+-------------------------+-----|
  104.  | RS6 | TsyncTmr | 1. Timer not running    | Start 10 second timer   | RS5 |
  105.  |     |          |                         | Reset 20 sec timer      |     |
  106.  |     |          +-------------------------+-------------------------+-----|
  107.  |     |          | 2. Timer running        | Two TSYNCS = FTS-0001   | exit|
  108.  |-----+----------+-------------------------+-------------------------+-----|
  109.  | RS7 | ExtMail  | 1. String matched       | External mail selected  | exit|
  110.  |     |          +-------------------------+-------------------------+-----|
  111.  |     |          | 2. Checked all strings  | Get next input character| RS5 |
  112.  `-----+----------+-------------------------+-------------------------+-----'
  113.  
  114.  */
  115.  
  116.  
  117. /* Include this file before any other includes or defines! */
  118.  
  119. #include "includes.h"
  120.  
  121. /*
  122.  * Dat